package com.sqx.modules.recovery.controller.app;

import com.sqx.common.utils.Result;
import com.sqx.modules.recovery.entity.GoodsSpecifications;
import com.sqx.modules.recovery.service.GoodsSpecificationsService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.io.IOException;

/**
 * @description：TODO
 * @author： qiao
 * @create： 2024/10/14 19:51
 */
@RestController
@RequestMapping("/app/goodsSpecifications")
@Api(value = "商品规格相关-用户端",tags = {"商品规格相关-用户端"})
public class AppGoodsSpecificationsController {

    @Autowired
    private GoodsSpecificationsService goodsSpecificationsService;

    @GetMapping("/getSpecificationsList")
    @ApiOperation("获取二手物品回收规格列表")
    public Result getSpecificationsList(@ApiParam("页码") @RequestParam(value = "pageNum",required = false) Integer pageNum,
                                        @ApiParam("条数")@RequestParam(value = "pageSize",required = false) Integer pageSize,
                                        @ApiParam("二手物品回收估价id")@RequestParam(value = "recoveryId",required = false) Long recoveryId){
        return goodsSpecificationsService.getGoodsSpecificationsList(pageNum, pageSize, recoveryId);
    }

    @GetMapping("/getSpecificationsById")
    @ApiOperation("获取二手物品回收规格详情")
    public Result getSpecificationsById(@ApiParam("二手物品规格id")@RequestParam(value = "id") Long id) {
        return goodsSpecificationsService.getGoodsSpecificationsById(id);
    }

    @GetMapping("getFirstSpecificationsList")
    @ApiOperation("获取一级规格列表")
    public Result getFirstSpecificationsList(@ApiParam("页码")Integer pageNum,
                                             @ApiParam("条数")Integer pageSize,
                                             @ApiParam("商品规格实体")GoodsSpecifications goodsSpecifications){
        return goodsSpecificationsService.getFirstSpecificationsList(pageNum, pageSize, goodsSpecifications);
    }

    @GetMapping("getSecondSpecificationsList")
    @ApiOperation("获取二级规格列表")
    public Result getSecondSpecificationsList(@ApiParam("页码")Integer pageNum,
                                              @ApiParam("条数")Integer pageSize,
                                              @ApiParam("商品规格父id，暂未使用")Long parentId){
        return goodsSpecificationsService.getSecondSpecificationsList(pageNum, pageSize, parentId);
    }

}
